package com.hmkj.core.service.amount;

import com.hmkj.core.api.lianlian.PayDataBean;
import com.hmkj.core.model.amount.CashModel;
import com.hmkj.core.po.amount.Cash;
import com.hmkj.core.po.user.User;
import com.hmkj.core.service.base.GenericService;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 操作权限业务相关Service接口<br>
 *
 * @author donfy
 * @ClassName: CashService
 * @date 2017-08-15 08:16:12
 */
public interface CashService extends GenericService<Integer, Cash> {

    /**
     * 提现审核
     *
     * @param model 提现类型
     * @throws Exception ex
     */
    void doAudit(CashModel model, String apiUrl) throws Exception;

    /**
     * 取现
     *
     * @param user   取现用户
     * @param bankId 用户银行卡id
     * @param amount 取现金额
     * @param apiUrl api地址跟路径
     * @return
     */
    Map<String, String> doCash(User user, Integer bankId, BigDecimal amount, String apiUrl);

    /**
     * 提现校验
     *
     * @param user   提现用户
     * @param amount 提现金额
     */
    void checkCash(User user, BigDecimal amount);

    /**
     * 取消提现
     *
     * @param id
     */
    void doCancel(Integer id);


    void handCash(Cash cash);

    /**
     * 根据状态统计提现金额
     *
     * @param status
     * @return
     */
    BigDecimal selectSumAmountByStatus(Integer status, String startTime, String endTime, Integer agentId);

    /**
     * 根据状态统计提现笔数
     *
     * @param status
     * @return
     */
    long countByStatus(Integer status, String startTime, String endTime, Integer agentId);


    /**
     * 联动优势快捷支付异步回调处理业务
     */
    void handleCashByUmpay(String tradeNo, String orderId, String amount, String tradeState, String retMsg);

    /**
     * 提现创建出金订单
     *
     * @param bankCardId 银行卡id
     * @param money      出金金额
     */
    void createCash(String bankCardId, BigDecimal money, User user);


    /**
     * 提现审核
     *
     * @param model 提现类型
     * @throws Exception ex
     */
    void doAuditLianLian(CashModel model) throws Exception;

    /**
     * 连连代支付处理订单
     *
     * @param payDataBean
     * @throws Exception
     */
    void handleOrderByLianLian(PayDataBean payDataBean) throws Exception;

    /**
     * 连连代付接口查询
     *
     * @param cash
     * @return
     * @throws Exception
     */
    void queryOrderByLianLian(Cash cash) throws Exception;

    /**
     * 提现审核-华融代付
     *
     * @param cashModel
     */
    void doAuditHR(CashModel cashModel) throws Exception;

    /**
     * 华融代付异步通知
     *
     * @param retMap
     */
    void doCashNotifyHR(Map<String, String> retMap) throws Exception;

    /**
     * 查询华融代付订单状态，并更新提现记录
     *
     * @param cash
     */
    void queryOrderByHR(Cash cash) throws Exception;
}
